import request from '@/utils/request'

// 查询费用申请列表
export function listApply(query) {
  return request({
    url: '/crm/apply/list',
    method: 'get',
    params: query
  })
}

// 查询费用申请详细
export function getApply(applyId) {
  return request({
    url: '/crm/apply/' + applyId,
    method: 'get'
  })
}

// 新增费用申请
export function addApply(data) {
  return request({
    url: '/crm/apply',
    method: 'post',
    data: data
  })
}

// 修改费用申请
export function updateApply(data) {
  return request({
    url: '/crm/apply',
    method: 'put',
    data: data
  })
}

// 删除费用申请
export function delApply(applyId) {
  return request({
    url: '/crm/apply/' + applyId,
    method: 'delete'
  })
}

// 提交
export function submit(data) {
  return request({
    url: '/crm/apply/submit',
    method: 'post',
    data: data
  })
}

// 回撤提交
export function cancelInfo(data) {
  return request({
    url: '/crm/apply/cancelInfo',
    method: 'post',
    data: data
  })
}

// 审核
export function audit(data) {
  return request({
    url: '/crm/apply/audit',
    method: 'post',
    data: data
  })
}

// 通过商机id和创建人或者归属人查询费用信息
export function selectCrmFeeApplyByOrderIdAndCreateBy(orderId) {
  return request({
    url: '/crm/apply/selectCrmFeeApplyByOrderIdAndCreateBy/' + orderId,
    method: 'get'
  })
}